package com.gitee.minimalismstyle.fresh.common.core.validate

import java.math.BigDecimal
import java.util.regex.Pattern


class NumberValueValidate : ValueValidate {

    override fun check(value: Any?, params: String?): ValidateResult {
        return if(value == null || value.equals("")){
            ValidateResult(true)
        } else {
            if(Pattern.matches("-?[0-9]+.？[0-9]*", value.toString())){
                ValidateResult(true)
            }else{
                ValidateResult(false, "必须是数字")
            }
        }
    }
}